import Vue from 'vue'
import iView from 'view-design'
import 'view-design/dist/styles/iview.css'
import App from './app.vue'
import util from './libs/util'
import router from './router/router'
import store from './store/store'
import VueI18n from 'vue-i18n'
import localeI18n from './i18n/index'
import ButtonLimited from './views/components/button-limited'
import byStore from 'biyi-store'
import element from 'element-ui'
import jquery from 'jquery'
import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: '6Rg8pyRGSg6XLwUUBLv2Q3Q1gAsnQjVV'
})
window.$ = window.jQuery = jquery
import { iconList } from './libs/icon.js'
Vue.prototype.getNowFormatDate = function () {
  var date = new Date()
  var seperator1 = "-"
  var year = date.getFullYear()
  var month = date.getMonth() + 1
  var strDate = date.getDate()
  if (month >= 1 && month <= 9) {
    month = "0" + month
  }
  if (strDate >= 0 && strDate <= 9) {
    strDate = "0" + strDate
  }
  var currentdate = year + seperator1 + month + seperator1 + strDate
  return currentdate
}
Vue.prototype.$iconList = iconList
Vue.config.productionTip = false
Vue.prototype.$util = util
Vue.prototype.$http = util.http
// Vue.prototype.$ = jquery
Vue.use(VueI18n)
Vue.use(byStore)
Vue.use(element)
Vue.use(iView, {
  i18n: function (path, options) {
    let value = i18n.t(path, options)
    if (value !== null && value !== undefined) {
      return value
    }
    return ''
  }
})

Vue.component('Button', ButtonLimited)

// Vue.locale = () => { }

const i18n = new VueI18n(localeI18n)

const vm = new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')

export default vm
